﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommonLib.Geometry;
using Microsoft.DirectX;

namespace RayTracerLib.Engine
{
    /// <summary>
    /// Представляет собой камеру
    /// </summary>
    public class Camera
    {
        public Vector3 n, u, v;
        public float W; //2W - Ширина ближней плоскости
        public float H;//2H - Высота ближней плоскости
        public Point3D Eye; //Расположение камеры         
        public float nearDist;//Расстояние до ближней плоскости
        public Camera(Point3D eye, Vector3 look, float w, float h, float near)
        {
            Eye = eye;
            W = w;
            H = h;
            nearDist = near;
            Vector3 up = new Vector3(0, 1, 0);
            n = new Vector3(eye.X - look.X, eye.Y - look.Y, eye.Z - look.Z);
            u = Vector3.Cross(up, n);
            n.Normalize();
            u.Normalize();
            v = Vector3.Cross(n, u);
        }
    }
}
